﻿using ShapeManager;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using Tools;
using UserControls;

namespace ROI编辑器.Tools
{
    public class ToolCircle : ToolObject
    {
        public ToolCircle()
        {
            try
            {
                Cursor = new Cursor("Cursor/circle.cur");
            }
            catch { }
        }
        public override void OnMouseDown(UImageWindow uImageWindow, MouseEventArgs e)
        {
            AddNewObject(uImageWindow, new UCircle(e.X, e.Y, 1));
        }
        public override void OnMouseMove(UImageWindow uImageWindow, MouseEventArgs e)
        {
            try { uImageWindow.Cursor = Cursor; }
            catch (Exception ex) 
            {
                uImageWindow.Cursor = Cursors.Default;
                Debug.WriteLine(ex.Message); 
            }
            if (e.Button == MouseButtons.Left)
            {
                Point point = new Point(e.X, e.Y);
                uImageWindow.ShapeList[0].MoveHandleTo(point, 4);
                uImageWindow.Refresh();
            }
        }
    }
}
